package com.shujia.Phoenix;

import java.sql.*;

public class PhoenixJDBC {
    public static void main(String[] args) throws SQLException {
        Connection connection = DriverManager.getConnection(
                "jdbc:phoenix:master,node1,node2:2181"
        );
        PreparedStatement preparedStatement = connection.prepareStatement(
                "select mdn,x,y,county from dianxin where x=? and y =? "
        );

        preparedStatement.setDouble(1,117.288);
        preparedStatement.setDouble(2,31.822);

        ResultSet resultSet = preparedStatement.executeQuery();
        while (resultSet.next()){
            String mdn = resultSet.getString("mdn");
            String county = resultSet.getString("county");
            System.out.println("mdn:"+mdn+"|county:"+county);
        }
        preparedStatement.close();
        connection.close();
    }
}
